<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<script type="text/javascript" src="../js/jquery-3.3.1.js"></script>
<body>
    <form action="javascript:void(0);" method="post">
        账号<input type="text" id="userName"/><br/>
        密码<input type="password" id="userPassword"/><br/>
        姓名<input type="text" id="presonName"/><br/>
	年龄<input type="number" id="personAge"/><br/>
	性别:
		男<input type="radio" name="personSex" value="male" checked="checked">
		女<input type="radio" name="personSex" value="female"><br/>
	电话<input type="text" id="telephone"/><br/>
    <input type="submit" value="注册"/>
    </form>
</body>
<script type="text/javascript">
	$(":submit").click(function(){
		$.ajax({
			url:'regist',
			method:'get',
			contentType:'application/json',
			dataType:'json',
			data:{
				'userName':$("#userName").val(),
				'userPassword':$("#userPassword").val(),
				'presonName':$("#presonName").val(),
				'personAge':$("#personAge").val(),
				'personSex':$(":radio[name='personSex']:checked").val(),
				'telephone':$("#telephone").val()
			},
			success:function(data){
				if(data){
					window.location.href="index.jsp";
				}
			}
		});
	});
</script>
</html>